package realQuestion.ali;

import java.util.*;

public class Main1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] nums=new int[n];
        for (int i = 0; i < n; i++) {
            nums[i]=scanner.nextInt();
        }

        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            if (!map.containsKey(nums[i])){
                map.put(nums[i],0);
            }
            map.put(nums[i], map.get(nums[i])+1);
        }
        Iterator<Map.Entry<Integer, Integer>> iterator = map.entrySet().iterator();


        int size = map.size();
        int[] ints = new int[size];
          int i=0;
        while (iterator.hasNext()){
            Map.Entry<Integer, Integer> entry = iterator.next();
            int  key = entry.getKey();
            int value = entry.getValue();
            int f = f(key, value,nums);
            ints[i]=f;
            i++;
        }
        System.out.println(size);
        Arrays.sort(ints);
        for (int j = 0; j < size; j++) {
            System.out.print(ints[j]);
            if (j!=size-1){
                System.out.print(" ");
            }

        }



    }

    public  static  int f(int key,int value,int[] nums){
        int find= (int) Math.ceil((double) value/2);
        int count=0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i]==key){
                count++;
                if (count==find){
                    return i;
                }


            }


        }

        return -1;
    }





}
